import 'package:flutter/material.dart';
import 'package:qunaimedical/components/custom_avatar.dart';
import 'package:qunaimedical/models/doctor.dart';
import 'package:qunaimedical/pages/doctor_simple_detail.dart';

/// 会诊接受人条目
class ItemReceiver extends StatelessWidget {
  final Doctor item;
  final bool clickable;

  const ItemReceiver({Key key, this.item, this.clickable}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: (clickable ?? true)
          ? () {
              Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (c) =>
                          DoctorSimpleDetailPage(doctorId: item.id)));
            }
          : null,
      child: Container(
        height: 100,
        color: Colors.white,
        child: Row(
          children: [
            CustomAvatar(
              avatarUrl: item.avatar,
              margin: EdgeInsets.all(16),
            ),
            Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  item.fullname,
                  style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
                ),
                SizedBox(height: 5),
                Text(
                  '${item.sectionName} ${item.professionalName ?? ''}',
                  style: TextStyle(color: Colors.grey[800]),
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}
